| 1 | import Cocoa |
| 2 | |
| 3 | extension NSScreen { |
| 4 | static var screenWithMouse: NSScreen? { |
| 5 | let mouseLocation = NSEvent.mouseLocation |
| 6 | for screen in NSScreen.screens { |
| 7 | if NSMouseInRect(mouseLocation, screen.frame, false) { |
| 8 | return screen |
| 9 | } |
| 10 | } |
| 11 | return NSScreen.main |
| 12 | } |
| 13 | } |